>For entry level programming, I'd recommend one of the following:
>Logo, Basic, or HyperCard.d
>
What's a good language to learn programming ?
People who learn programming want to take care of the algorithm, not of
the syntax or of the implementation.
It seem obvious for me that if they want to learn programming
*seriously* (not only to write 20-lines programs in Basic) they need a
structured language who support sub-programs (or procedures or
functions). The 'standard' Basic (the Basic instructions compatibles
with most implementations of Basic) doesn't support sub-programs; I know
two syntax for sub-programs in Basic, incompatibles with each-other !
That's the problem with Basic (and some other languages of the same
kind): lots of incompatibilities, most books/examples have a specific
(and not Macintosh) syntax (even if they express simple things). I
believe that it is far easier to write a program (portable or not)
longer then 100 lines in Pascal or C then in Basic.
For all these reasons, I think that languages able to express algorithms
with a natural syntax are Pascal, C, C++, Ada...
The problem with Pascal is that the ISO standard has disappeared under
the TurboPascal standard.
In my opinion, C is the best choice because it is portable, it has a
good ANSI library, it has type-checking, and C programs can easily be
converted to C++ (an Object Oriented Pascal exists, but C++ is really
better).
Valentin Bonnard
bonnardv@pratique.fr
+++++++++++++++++++++++++++
>From jhalmen@news.abo.fi (Johan Halmen UPR)
Date: 8 Jan 1996 00:36:15 GMT
Organization: Abo Akademi University
bonnardv@pratique.fr wrote:
: What's a good language to learn programming ?
: In my opinion, C is the best choice because it is portable, it has a
: good ANSI library, it has type-checking, and C programs can easily be
: converted to C++ (an Object Oriented Pascal exists, but C++ is really
: better).
If one starts learning programming from scratch¸ I believe Pascal
is better than C. It is originally developed for teaching
programming¸ C was developed for professional programmers to
develope the Unix system. I don't say that C is a bad choice¸
only that it's next to best. If you don't have the slightest
idea of what programming is¸ choose Pascal¸ otherwise C.
Johan Halmen
+++++++++++++++++++++++++++
>From andy@ldd.net (Andrew Engle)
Date: 8 Jan 1996 04:57:46 GMT
Organization: Southeast Missouri State University
In article <4cpotv$op9@josie.abo.fi>, jhalmen@news.abo.fi says...
>If one starts learning programming from scratch¸ I believe Pascal
>is better than C. It is originally developed for teaching
>programming¸ C was developed for professional programmers to
>develope the Unix system. I don't say that C is a bad choice¸
>only that it's next to best. If you don't have the slightest
>idea of what programming is¸ choose Pascal¸ otherwise C.
>
>Johan Halmen
Curious that you should make such a post! In about a week, I will begin my
first university course that deals with C. Specifically the course is titled
"C and the Unix Environment". While I'm not exceedingly concerned about the
Unix portion of the curriculum, the C concerns me. All my prior Computer
Science courses dealt strictly with Pascal (Turbo, to be precise, including the
OOP extensions).
My question to you and any others who may be kind enough to lend a word of
advice is what types of pitfalls and other curious things should I be wary of
and/or lend additional scrutiny to in my transition from Pascal to C?
Thank you very much in advance for anything you might send my way.
Andrew Engle
+++++++++++++++++++++++++++
>From stacys@isis.interpac.net (Stacy Sherman)
Date: 8 Jan 1996 06:14:11 GMT
Organization: Inter-Pacific Networks
C should never be used as a first programming language, especially at
high school level. I got my CS degree in '91 and they were teaching most
of the courses in Pascal and were just starting to use C. Even now, the
first few courses are still taught in Pascal.
You want to teach them HOW to program. Not how to program in C. It's
really easy to screw up & get frustrated in C. Plus, C relies heavily on
pointers which are a difficult concept for many people.
CodeWarrior academic might be a good choice, or the codewarrior starter
kit. They have both C and Pascal built in. Just because it can't
generate PPC code doesn't mean it can't be used on the PowerMac. You can
run the compiler on the PowerMac and any programs you create with them.
The programs won't be native, that's all.
Stacy
+++++++++++++++++++++++++++
>From waldo@buffnet.net (Kevin Eye)
Date: Mon, 08 Jan 1996 20:38:24 -0500
Organization: BuffNET
>: What's a good language to learn programming ?
I'd have to say Think Pascal is good to learn and about the quickest to
throw together programs in (of the high level languages/compilers). Don't
use HyperCard ( It's great and a real advantage of a mac, but it won't get
you anywhere.) or BASIC. If you learn Pascal, C is simple to learn and
vice versa, but Think Pascal automates a lot of the tricky compiling
stuff, but the language is the same. Maybe I'm biased because I only
recently got C with CodeWarrior but I still like the Think Pascal
environment better, especially for beginning.
+++++++++++++++++++++++++++
>From gilmoure@mailhost.acc.net (Glenn)
Date: 10 Jan 1996 00:28:32 GMT
Organization: acc.net Orlando
Hi! This is in similar vein. I am in an intro Pascal course at college.
They use Turbo 7 Pascal for pcs and finished assignments have to run in
dos. Anyone know of a mac compilar that will spit out dos stuff? CW,
perhaps? The box didn't mention anything about that. TIA,
glenn
--
Gilmoure of Trimaris
'70 Triumph chopper (project)
**Think about it, Murray. ... If we could get this baby runnin', we could run over hikers, pick up females, chase down mule deer-man, we'd be the grizzelies from hell.** G.Larson
+++++++++++++++++++++++++++
>From Valentin Bonnard <bonnardv@pratique.fr>
Date: 10 Jan 1996 12:31:53 GMT
Organization: Internet Way
waldo@buffnet.net (Kevin Eye) wrote:
>>: What's a good language to learn programming ?
>
>I'd have to say Think Pascal is good to learn and about the quickest to
>throw together programs in (of the high level languages/compilers). Don't
>use HyperCard ( It's great and a real advantage of a mac, but it won't get
>you anywhere.) or BASIC. If you learn Pascal, C is simple to learn and
>vice versa, but Think Pascal automates a lot of the tricky compiling
>stuff, but the language is the same. Maybe I'm biased because I only
>recently got C with CodeWarrior but I still like the Think Pascal
>environment better, especially for beginning.
I have used Think Pascal and Turbo Pascal for DOS at the same time and tried to run the same programs; the problem with Think Pascal=
is the number of incompatibilities with Turbo Pascal, one example:
procedure foo; ... exit (Foo); { Think, not Turbo }
procedure foo; ... exit; { Turbo, not Think }
(But if you wanted to have some compatibility between platforms, you would *not* have chosen Pascal.)
I had problems in Think Pascal with the editor too: sometimes, when you make a syntax fault, the editor prevents you from correcting=
it.
Valentin Bonnard
bonnardv@pratique.fr
+++++++++++++++++++++++++++
>From Valentin Bonnard <bonnardv@pratique.fr>
Date: 11 Jan 1996 01:05:31 GMT
Organization: Internet Way
andy@ldd.net (Andrew Engle) wrote:
>My question to you and any others who may be kind enough to lend a word of
>advice is what types of pitfalls and other curious things should I be wary of
>and/or lend additional scrutiny to in my transition from Pascal to C?
To understand the following, you should first learn the basic keywords and syntax for functions, blocks...
I will only point-out the not-so-obvious differences...
MY notations:
<=> mean is equivalent to
-> mean the Pascal code ...
In addition to the fact that BEGIN gives { and that there are no DO there are significant differences between Pascal and C.
First of all:
* for if else do while return break typedef int short float double... are *reserved* keywords (cannot be used for another thing); no=
predefined that can be changed (like WriteLn, ReadChar...).
* the capitalisation is significant ('For' can be a variable name, but 'for' can only be used for "for (i=1; i<2; i=i+1) or for (i=1=
; i<2; i++) since i++ signifies i=i+1".
The Integers Types
==================
CHAR (8 bits) char (sometimes signed, sometimes unsigned,
write 'unsigned char' to be sure)
INTEGER (16 bits) short = short int, *not int*
int (16 or 32 bits, natural word)
LONGINT (32 bits) long = long int
char is just an integer type, like any others.
---------------
The Boolean Type, Some Logic
============================
The BOOLEANs are replaced by int (or Boolean on the Mac, or Bool on PC, each of them defined as int, or short int); TRUE if <> 0, FA=
LSE if = 0, thus
IF a THEN /* a being a BOOLEAN */
-> if (a) /* a being of any integer type or a pointer to what you want */
<=> if (a != 0) /* != mean <> */
IF NOT a THEN
-> if (!a) /* NOT -> ! */
<=> if (a != 0) /* != mean <> */
TRUE is defined as the integer 1, FALSE as 0
IF a = FALSE -> if (a == FALSE) <=> if (! a)
Logical operators
=================
and (resp. or) operators are &&,& (||,|)
if (a && b) if-block else else-block
<=> if (a) if (b) if-block else else-block
For && and ||, the second operand is evaluated only if the first doesn't tell the answer (if a is true, that is to say <> 0, a || b =
is true.
As a beginner, you should not write that: (well, I do)
if (a && DoSomethingAndReturnResult)
/* because DoSomethingAndReturnResult is executed only if a is true,
which is unclear */
On the contrary, & and | are bit-wise operators (and ^ is the bit-wise XOR), and the two operands are *always* evaluated.
In TurboPascal, the distinction exists as a flag {S+} or something like that... In Think Pascal this flag doesn't work. So there is =
an ambiguity in Pascal that don't exist in C.
Some operators
==============
First, don't forget:
{Pascal} a := b; -> a = b;
{Pascal} a = b; -> a == b;
{Pascal} a <> b; -> a != b;
You can write:
a = b;
a += b; <=> a = a + b;
a -= b; <=> a = a - b;
a *= b; <=> a = a * b;
a /= b; <=> a = a / b; /* for float (Pascal /) and integer (Pascal DIV) */
a %= b; <=> a = a % b; /* MOD */
a &= b; <=> a = a & b; /* bit-wise */
a |= b; <=> a = a | b; /* bit-wise */
a ^= b; <=> a = a ^ b; /* bit-wise */
++a; <=> a += 1; <=> a = a + 1;
--a; <=> a -= 1; <=> a = a - 1;
where a is a left-value (something that can be assigned) and b a value
A left-value is:
- a variable, member of struct (RECORD), union (RECORD CASE OF), array...
- *addr, where addr is a value
ALL of them return the value of 'a' after the computation except a++ and a-- which return the value before the incrementation/decrem=
entation.
Functions and Procedures
========================
There is no difference between functions and procedures:
A procedure is a function that return void (void mean nothing); a statement is simply a expression. These are legal:
3; 4+5; a+b+5; /* given a and b are defined */
a = b = 3; <=> a = (b = 3); <=> b = 3; a = b;
char ReadKey (void);
char ReadKey ()
{
char key;
......
return key;
}
char c;
c = ReadKey (); /* the return value is used */
ReadKey (); /* this is legal: the return value is not used */
Note
====
I have wrote here some explanations about what seem to be important for the C beginner; I have forgotten lots of things.
Valentin Bonnard
bonnardv@pratique.fr
+++++++++++++++++++++++++++
>From gilmoure@mailhost.acc.net (Glenn)
Date: 10 Jan 1996 00:28:32 GMT
Organization: acc.net Orlando
Hi! This is in similar vein. I am in an intro Pascal course at college.
They use Turbo 7 Pascal for pcs and finished assignments have to run in
dos. Anyone know of a mac compilar that will spit out dos stuff? CW,
perhaps? The box didn't mention anything about that. TIA,
glenn
--
Gilmoure of Trimaris
'70 Triumph chopper (project)
**Think about it, Murray. ... If we could get this baby runnin', we could run over hikers, pick up females, chase down mule deer-man, we'd be the grizzelies from hell.** G.Larson
+++++++++++++++++++++++++++
>From skershaw@scu.edu.au (Shane Kershaw)
Date: Sat, 13 Jan 1996 11:39:32 +1100
Organization: Virtual Studios, Faculty of Arts, Southern Cross University
In article <4cqcnj$387@pegasus.interpac.net>, stacys@isis.interpac.net
(Stacy Sherman) wrote:
>C should never be used as a first programming language, especially at
>high school level. I got my CS degree in '91 and they were teaching most
>of the courses in Pascal and were just starting to use C. Even now, the
>first few courses are still taught in Pascal.
I agree with you here Stacy (where did you do your degree?). Our Uni has
just changed all of its coding courses and removed Pascal from the
curriculum entirely. Tis worriesme, especially as they included Visual
Basic as an example of RAD environemnt (not, I would have thought:-).
> You want to teach them HOW to program. Not how to program in C. It's
> really easy to screw up & get frustrated in C. Plus, C relies heavily on
> pointers which are a difficult concept for many people.
Again I agree. I stil lthe think that best approach that can be applied
here is to use the good old pencil and paper compiler for the first
semester course - don't let them near a machine until they can express
their intentions algorithmically, this will ultimately lead to better code
and results for the students, because they won;t be fighting the
have-I-got-the-right-algorithm battle whilst trying to learn the syntax
and smemantics of whatever language they are using. One of the best
things I liked about my degree was that I was able to do a comparative
study of languages in the same semester I had to do the cobol unit - C,
Pascal, Modula2, Cobol and hypertalk (v1.2.5). In some cases what was
required in the cobol unit algorithmically was also required in the comp
lang unit, so I was abler to see that the algorithm didn't change, but the
implementation of the algorithm might, i.e. two lines of code in c, maybe
3 in pascal (no ternary if statement) and 6 lines in cobol. It was an eye
opener and has made me an advocate of algorithm first, implementation
second approach to coding.
> CodeWarrior academic might be a good choice, or the codewarrior starter
> kit. They have both C and Pascal built in. Just because it can't
> generate PPC code doesn't mean it can't be used on the PowerMac. You can
> run the compiler on the PowerMac and any programs you create with them.
> The programs won't be native, that's all.
Uum, I wansn't aware that this was the case - I use CW academic and don't
have any problem generating PPC only code. The only limitation of CW
academic is that you can't sell your programs - no more, no less.
Shane
--
Shane Kershaw
Co-moderator of sci.psychology.research
Systems Administration, Virtual Studios
Southern Cross University, NSW Australia
+++++++++++++++++++++++++++
>From tblancha@evolving.com (Todd Blanchard)
Date: 23 Jan 1996 00:26:52 GMT
Organization: Evolving Systems, Inc.
Shane Kershaw (skershaw@scu.edu.au) wrote:
: In article <4cqcnj$387@pegasus.interpac.net>, stacys@isis.interpac.net
: (Stacy Sherman) wrote:
: >C should never be used as a first programming language, especially at
: >high school level. I got my CS degree in '91 and they were teaching most
: >of the courses in Pascal and were just starting to use C. Even now, the
: >first few courses are still taught in Pascal.
Well, I teach CS at Univ of Colorado Denver and we've started to do our
data structures class using C++. Its more strongly typed than C so its a
bit safer to learn with.
RE: Pointers are difficult - yes they are, but all truly powerful concepts
are. For teaching algorithms, it is hard to beat C.